# encoding: utf-8
"""
@author: 夏洛
@QQ: 1972386194
@file: 03-opencv处理缺口.py
"""
import cv2

# 滑块的缺口距离识别
def get_distance():
    img = cv2.imread('image/image.png', 0)
    template = cv2.imread('image/template.png', 0)
    res = cv2.matchTemplate(img, template, cv2.TM_CCORR_NORMED)
    value = cv2.minMaxLoc(res)[2][0]
    print(value)
    distance = value * 278/360
    print(distance)
    return distance

